const http = require('http');

const server = http.createServer((req,res)=>{
      res.setHeader('content-type', 'text/html;charset=utf-8')
      // console.log('req=1111>',req)
      const {method} = req;
      console.log('methodes=>',method);
      let {pathname} = new URL(req.url, 'http://127.0.0.1');
      console.log('pathname=>',pathname);
      if(method === 'GET' && pathname === '/login'){
            res.end('登录');
      }else if(method === 'GET' && pathname === "/reg")
            res.end('注册')
      else{
            res.end('你好')
      }
})

server.listen(9000,()=>{
      console.log('服务器已启动：127.0.0.1:9000s')
})